import { GSprite } from "../../../../../../com/mui/controls/GSprite";
import { RuneSWallowedEffect } from "./RuneSWallowedEffect";
import { ItemData } from "../../../../resource/info/ItemData";
import { RuneSwallowConfig } from "../../../../resource/RuneSwallowConfig";
import { DisplayUtil } from "../../../../../common/DisplayUtil";
//class RuneSWallowedEffects
    
    export  class RuneSWallowedEffects extends GSprite
    {
        constructor()
        {
            super();
            this._effects = [];
            this._effectsContainer = new Object /* flash.display.Sprite */();
            this.initEffect();
            return;
        }

        /* internal  */initEffect(): void
        {
            var loc2=null;
            this._effects = [];
            var loc1=0;
            while (loc1 < 8) 
            {
                loc2 = new RuneSWallowedEffect();
                this._effects.push(loc2);
                ++loc1;
            }
            return;
        }

        public set enabledEffect(arg1: Boolean)
        {
            this._enabledEffect = arg1;
            return;
        }

        public getHeight(): number
        {
            return this._myHeight;
        }

        public updateData(arg1: ItemData): void
        {
            var loc3=null;
            var loc5=0;
            var loc6=false;
            var loc1=RuneSwallowConfig.instance.getHolyRuneCanSwllowCodes(arg1.itemCode);
            var loc2=arg1.runeSwallowCodes;
            this._myHeight = 0;
            var loc4=0;
            while (loc4 < this._effects.length) 
            {
                loc3 = this._effects[loc4] as RuneSWallowedEffect;
                DisplayUtil.removeMe(loc3);
                ++loc4;
            }
            if (loc1 == null) 
            {
                this.removeChild(this._effectsContainer);
            }
            else 
            {
                loc4 = 0;
                while (loc4 < loc1.length) 
                {
                    loc5 = loc1[loc4];
                    loc6 = false;
                    loc3 = this._effects[loc4] as RuneSWallowedEffect;
                    if (loc2 && loc2.length > 0) 
                    {
                        if (loc2.indexOf(loc5) >= 0) 
                        {
                            loc6 = true;
                        }
                    }
                    loc3.setData(loc5, loc6);
                    loc3.y = this._myHeight;
                    this._effectsContainer.addChild(loc3);
                    this._myHeight = this._myHeight + loc3.height;
                    ++loc4;
                }
                this.addChild(this._effectsContainer);
            }
            return;
        }

        /* internal */ /* var */_effects: Array<any>;

        /* internal */ /* var */_effectsContainer: Object /* flash.display.Sprite */;

        /* internal */ /* var */_myHeight: number=0;

        /* internal */ /* var */_enabledEffect: Boolean=true;
    }
